home *** CD-ROM | disk | FTP | other *** search
Text File | 1999-03-04 | 3.5 KB | 174 lines | [TEXT/ToyS] |
- -- Preferences
- property kasPrefName : "Foreign Aliases 1.0"
-
- -- Globals
- global gasInfoWind -- Info window
- global gasInfoPos -- Position of info window
- global gasFoldersToDo -- The folders left to process
- global gasTrashed -- Number gone!
- global gasChecked -- Number checked!
-
-
- on open fsObjs
- -- Load prefs, show window
- pfLoad()
-
- set gasTrashed to 0
- set gasChecked to 0
-
- set gasInfoWind to display info titled kasPrefName ¬
- located at gasInfoPos ¬
- message "Scanning…"
-
- -- Do files
- set gasFoldersToDo to {}
-
- repeat with fsObj in fsObjs
- set myInfo to (basic info for fsObj)
-
- if (system type of myInfo is "fold") then
- set gasFoldersToDo to gasFoldersToDo & {fsObj}
- else if (catalog kind of myInfo is an alias) then
- DoOne(fsObj)
- end if
- end repeat
-
- -- Do folders
- repeat while gasFoldersToDo is not {}
- -- Pop one off the end
- set n to the number of items of gasFoldersToDo
- set fsObj to item n of gasFoldersToDo
-
- if (n > 1) then
- set gasFoldersToDo to items 1 through (n - 1) of gasFoldersToDo
- else
- set gasFoldersToDo to {}
- end if
-
- display info gasInfoWind ¬
- message ("Folders to go: " & n) ¬
- at line 6 ¬
- using color (15 * 32)
-
- -- Process it
- GoDeep(fsObj)
- end repeat
-
- display info gasInfoWind message "DONE!"
-
- pause for 5 with seconds timing -- Let screen wait...
-
- set gasInfoPos to screen location of ¬
- (display info gasInfoWind with disposal)
-
- pfSave() -- Save window location
- end open
-
-
- on DoOne(fsObj)
- set aFileInfo to (alias info from fsObj)
-
- display info gasInfoWind ¬
- message "File: " & (original name of aFileInfo) ¬
- at line 2
-
- set gasChecked to gasChecked + 1
-
- try
- set myAlias to («event ÅkuFFiLA» fsObj)
- on error
- TrashFile(fsObj, "Alias load error.")
- return
- end try
-
- set aInfo to alias info from myAlias
-
- if (alias server of aInfo is not "") then
- TrashFile(fsObj, "Server alias.")
- return
- end if
-
- if (ARA number of aInfo is "") then
- try
- set myInfo to extended info for myAlias
- on error
- TrashFile(fsObj, "Alias resolve error.")
- return
- end try
-
- display info gasInfoWind message ¬
- (vol name of myInfo) & " <-> " & (alias volume of aFileInfo) ¬
- at line 13
-
- if (vol name of myInfo) is not (alias volume of aFileInfo) then ¬
- TrashFile(fsObj, "Foreign volume.")
- else
- TrashFile(fsObj, "Remote Access alias.")
- end if
-
- display info gasInfoWind ¬
- message ("Checked: " & gasChecked) ¬
- at line 7 ¬
- using color 15
- end DoOne
-
-
- on TrashFile(fsObj, reason)
- display info gasInfoWind ¬
- message reason at line 3
-
- collate fsObj with the trasher
-
- set gasTrashed to gasTrashed + 1
-
- display info gasInfoWind ¬
- message ("Trashed: " & gasTrashed) ¬
- at line 8 ¬
- using color (15 * 1024)
- end TrashFile
-
-
- on GoDeep(foldObj)
- display info gasInfoWind ¬
- message "Path: " & (foldObj as string)
-
- set daddy to foldObj as string
-
- -- Do aliases
- display info gasInfoWind ¬
- message "Scanning aliases" at line 5
-
- set myItems to the entries in foldObj ¬
- whose kinds are an alias
-
- repeat with myItem in myItems
- DoOne((daddy & myItem) as alias)
- end repeat
-
- -- Do folders
- display info gasInfoWind ¬
- message "Scanning subfolders" at line 5
-
- set myItems to the entries in foldObj ¬
- whose kinds are a folder
-
- repeat with myItem in myItems
- set gasFoldersToDo to gasFoldersToDo & {(daddy & myItem) as alias}
- end repeat
- end GoDeep
-
-
- on pfLoad()
- try
- set ourPrefs to (load preference named kasPrefName)
- set gasInfoPos to item 1 of ourPrefs
- on error
- set gasInfoPos to {0, 0}
- end try
- end pfLoad
-
-
- on pfSave()
- save preference {gasInfoPos} named kasPrefName
- end pfSave
-